home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-08-16 | 2.5 KB | 113 lines | [TEXT/KAHL] |
- ; ===================================================================== ;
- ;
- ; System : MacWorkStation
- ;
- ; Module : EXEC.a
- ;
- ; This is the header code for EXEC modules.
- ;
- ; ===================================================================== ;
-
- PRINT OFF
- INCLUDE 'Traps.a'
- INCLUDE 'ToolEqu.a'
- INCLUDE 'QuickEqu.a'
- INCLUDE 'SysEqu.a'
- PRINT ON
-
- * The following data module is used to define the QuickDraw global data area.
- * -----------
-
- QuickDraw RECORD IMPORT,DECREMENT
- thePort DS.L 1
- white DS.B 8
- black DS.B 8
- gray DS.B 8
- ltGray DS.B 8
- dkGray DS.B 8
- arrow DS.B cursRec
- screenBits DS.B 14
- randSeed DS.L 1
- ENDR
-
- EXEChdr MAIN ; start of EXEC code
- IMPORT EXEC ; pascal routine
- CASE ON
- IMPORT A5Alloc
- IMPORT A5Init
- IMPORT A5Dispose
- CASE OFF
-
- bra.s begEXEC ; branch around header
- dc.w 0 ; flags word
- dc.b 'MWSX' ; type
- dc.w 0 ; ID
- dc.w $0300 ; version
- myA5 dc.l 0 ; EXEC's A5
-
- begEXEC link a6,#-4
- move.l a5,-4(a6) ; save MWS A5
- move.l myA5,d0 ; have we already allocated globals
- bne.s @8 ; yes, go to TLPM
- CASE ON
- jsr A5Alloc ; else allocate a global area
- CASE OFF
- lea myA5,a0
- move.l d0,(a0) ; store it locally
- move.l d0,-(sp)
- CASE ON
- jsr A5Init ; initialize globals
- CASE OFF
- addq.l #4,sp ; clean up stack
- ;
- ; Move Quickdraw globals here also.
- ;
- move.l a1,-(sp)
- move.l (a5),a0 ; get MWS' quickdraw globals
- lea randseed(a0),a0
- move.l myA5,a5 ; get EXEC's quickdraw globals
- lea QuickDraw.randSeed,a1
- move.l #-randSeed,d0
- _BlockMove ; move MWS to EXEC
- move.l (sp)+,a1
- ;
- @8 move.l myA5,a5 ; get new A5
- move.w 12(a6),-(sp) ; tlCode
- move.l 8(a6),-(sp) ; @params
- jsr EXEC ; call exec module
- move.l -4(a6),a5 ; get old A5 back
- cmpi.w #5,12(a6) ; test if tlCode was close
- bne.s @9
- move.l myA5,-(sp) ; new A5
- CASE ON
- jsr A5Dispose
- CASE OFF
- addq.l #4,sp
-
- @9 unlk a6
- move.l (sp)+,a0
- addq #6,sp
- jmp (a0) ; return to caller
- ENDMAIN
- ;
- ; Interface back to MacWorkStation
- ; Must restore MWS' A5 before making the call
- ;
- CALLMWS PROC EXPORT
- link a6,#-4
- move.l a5,-4(a6) ; save EXEC A5
- move.l CurrentA5,a5 ; restore MWS A5
- move.l 12(a6),-(sp) ; get mesage parameter
- move.l 8(a6),a0 ; get address of routine
- jsr (a0)
- move.l -4(a6),a5 ; restore EXEC A5
- ;
- unlk a6
- move.l (sp)+,a0
- addq #8,sp
- jmp (a0)
- ENDPROC
-
- END
-
- ; end of EXEC.a